/*--------------------------------------------------------------
ip_user_m_axis_tuser:
[71:56]---rx_pkg_id
[55:24]---rx_ip_source_ip
[23:16]---rx_pkg_type
[15:0]---rx_ip_data_len

ip_user_s_axis_tuser:
[55:24]---tx_ip_target_ip
[23:16]---tx_pkg_type  udp=17
[15:0]---tx_ip_data_len

ip_m_axis_tuser:
[63:32]---tx_ip_target_ip
[31:16]---pkg_type  ip=0x0800
[15:0]---data_len

ip_s_axis_tuser:
[32]---rx_is_broadcast_flag
[31:16]---pkg_type  ip=0x0800
[15:0]---data_len
--------------------------------------------------------------*/


module ethernet_ip_top#(
    parameter   SOURCE_IP       = {8'd192,8'd192,8'd7,8'd11 }                   ,
    parameter   SOURCE_IP_MASK  = {8'd255,8'd255,8'd255,8'd0}                     
)(
    input                       i_clk                                           ,
    input                       i_rst                                           ,
    input                       i_set_source_ip_valid                           ,
    input   [31: 0]             i_set_source_ip                                 ,
    input                       i_set_source_ip_mask                            ,
    output                      ip_user_m_axis_tvalid                           ,
    output  [7 : 0]             ip_user_m_axis_tdata                            ,
    output                      ip_user_m_axis_tlast                            ,
    output  [71: 0]             ip_user_m_axis_tuser                            ,
    input                       ip_user_s_axis_tvalid                           ,
    input   [7 : 0]             ip_user_s_axis_tdata                            ,
    output                      ip_user_s_axis_tready                           ,
    input                       ip_user_s_axis_tlast                            ,
    input   [55: 0]             ip_user_s_axis_tuser                            ,
    output                      ip_m_axis_tvalid                                ,
    output  [7 : 0]             ip_m_axis_tdata                                 ,
    input                       ip_m_axis_tready                                ,
    output                      ip_m_axis_tlast                                 ,
    output  [64: 0]             ip_m_axis_tuser                                 ,
    input                       ip_s_axis_tvalid                                ,
    input   [7 : 0]             ip_s_axis_tdata                                 ,
    input                       ip_s_axis_tlast                                 ,
    input   [32: 0]             ip_s_axis_tuser                                 
);

    ip_rx #(
        .SOURCE_IP              ( SOURCE_IP                                     ),
        .SOURCE_IP_MASK         ( SOURCE_IP_MASK                                )
    )   
    ip_rx_inst (   
        .i_clk                  ( i_clk                                         ),
        .i_rst                  ( i_rst                                         ),
        .i_set_source_ip        ( i_set_source_ip                               ),
        .i_set_source_ip_valid  ( i_set_source_ip_valid                         ),
        .m_axis_tvalid          ( ip_user_m_axis_tvalid                         ), 
        .m_axis_tdata           ( ip_user_m_axis_tdata                          ), 
        .m_axis_tlast           ( ip_user_m_axis_tlast                          ), 
        .m_axis_tuser           ( ip_user_m_axis_tuser                          ), 
        .s_axis_tvalid          ( ip_s_axis_tvalid                              ), 
        .s_axis_tdata           ( ip_s_axis_tdata                               ), 
        .s_axis_tlast           ( ip_s_axis_tlast                               ), 
        .s_axis_tuser           ( ip_s_axis_tuser                               )
    );

    ip_tx #(
        .SOURCE_IP              ( SOURCE_IP                                     )
    )   
    ip_tx_inst (   
        .i_clk                  ( i_clk                                         ),
        .i_rst                  ( i_rst                                         ),
        .i_set_source_ip        ( i_set_source_ip                               ),
        .i_set_source_ip_valid  ( i_set_source_ip_valid                         ),
        .s_axis_tvalid          ( ip_user_s_axis_tvalid                         ),
        .s_axis_tdata           ( ip_user_s_axis_tdata                          ),
        .s_axis_tready          ( ip_user_s_axis_tready                         ),
        .s_axis_tlast           ( ip_user_s_axis_tlast                          ),
        .s_axis_tuser           ( ip_user_s_axis_tuser                          ),
        .m_axis_tvalid          ( ip_m_axis_tvalid                              ),
        .m_axis_tdata           ( ip_m_axis_tdata                               ),
        .m_axis_tready          ( ip_m_axis_tready                              ),
        .m_axis_tlast           ( ip_m_axis_tlast                               ),
        .m_axis_tuser           ( ip_m_axis_tuser                               )
    );

endmodule
